<link href="${rc.getContextPath()}/manage/css/dwzCustomCss/dwz.custom.css?v=${ver}" rel="stylesheet" type="text/css">
<script src="${rc.getContextPath()}/manage/js/dwzCustomJs/dwz.custom.tree.search.js?v=${ver}" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
    $("#searchTree",navTab.getCurrentPanel()).baseTreeSearch({
        inputTextId : "#searchPmodel", //搜索框的id
        alertMsg : "<@label key='Tree_search_Input.D'>输入名称进行查询</@label>", //提示内容，要考虑国际化，传自后台
        $p : navTab.getCurrentPanel()
        });
    
    $("#collapsable",navTab.getCurrentPanel())._treeCollapsable({
        $p : navTab.getCurrentPanel()
    })
    
    $("#expandable",navTab.getCurrentPanel())._treeExpandable({
        $p : navTab.getCurrentPanel()
    })
    
    var modelName = $("#searchPmodel").val();
    /* if(modelName && modelName!=''){
        $("#searchTree", navTab.getCurrentPanel()).click();
    } */
})

var BaseModelTree = {
        
    addModelCategory : function() {
        $("div#modelDetail", navTab.getCurrentPanel()).loadUrl(hostUrl+"/model/addModelDetailCategory", {"navTabId": '${navTabId!''}'});
    },
    
    addModel : function() {
        var tree = $("div#modeltree", navTab.getCurrentPanel());
        var $a = tree.find("div.selected a");
        var category = $a.attr("category");
        if(category){
            $("div#modelDetail", navTab.getCurrentPanel()).loadUrl(hostUrl+"/model/addModel",{"category": category, "navTabId": '${navTabId!''}'});
        }else{
            alertMsg.error("<@label key='Add_Model_Msg.D'>请选择一个类型节点进行操作!</@label>");
        }
    },
    
    importModel : function() {
        var tree = $("div#modeltree", navTab.getCurrentPanel());
        var $a = tree.find("div.selected a");
        if($a){
            var category = $a.attr("category");
            if(!category){
                alertMsg.error("<@label key='Add_Model_Msg.D'>请选择一个类型节点进行操作!</@label>");
                return;
            }else{
                $.pdialog.open(hostUrl+"/model/toImportModel?category="+category+"&navTabId=${navTabId!''}", "importmodel", "<@label key='export.B'>导入</@label>", {width: 500, height: 200, mask: true});
            }    
        }
    },
    
    viewModelCategory : function(_category) {
        if(_category){
            $("div#modelDetail", navTab.getCurrentPanel()).loadUrl(hostUrl+"/model/viewModelCategory", {"category":_category, navTabId:'${navTabId!''}'});
        }
    },
    
    reloadModelTree : function() {
        navTabPageBreak();
    }
}
</script>
<style type="text/css">
.tabs .tabsContent {
    background: #ffffff;
    border-color: #B8D0D6;
}
</style>
<div class="pageContent ">

    <div>
        <div id="modeltree" class="treeleft">
            <div class="mini-toolbar">
                <input type="text" id="searchPmodel" /> <a class="buttonActive" href="javascript:void(0)" id="searchTree"><span><@label key='search.B'>搜索</@label></span>
                </a>
            </div>
        <div class="pBar pBarBorder">
        <ul class="toolBar">
            <@buttonRight menuCode="modelCategory_add" labelKey="add_model_type.B" defalutName="新增类型">
            <li><a class="add" onclick="BaseModelTree.addModelCategory();" title="<@label key='add_model_type.B'>新增类型</@label>"><span><@label key="add_model_type.B">新增类型</@label></span>
            </a>
            </li></@buttonRight> <@buttonRight menuCode="processModel_add" labelKey="add_model.B" defalutName="新增模型">
            <li><a class="add" herf="javascript:;" onclick="BaseModelTree.addModel();" title="<@label key='add_model.B'>新增模型</@label>"><span><@label key='add_model.B'>新增模型</@label></span>
            </a>
            </li></@buttonRight> <@buttonRight menuCode="processModel_import" labelKey="export.B" defalutName="导入模型">
            <li><a class="icon" onclick="BaseModelTree.importModel();" title="<@label key='export.B'>导入模型</@label>"><span><@label key='export.B'>导入模型</@label></span>
            </a>
            </li></@buttonRight>
        </ul>
    </div>
            <div id="menuBar" class="pBar pBarBorder">
                <ul class="toolBar">
                    <li><a class="collapse" id="collapsable" title="<@label key="collapseAll.D">全部收起</@label>"><span><@label key="collapse.B">收起</@label></span> </a></li>
                    <li><a class="expand" id="expandable" title="<@label key="expandAll.D">全部展开</@label>"><span><@label key="expand.B">展开</@label></span> </a></li>
                </ul>
            </div>
            <div layoutH="95">
                <ul class="tree treeFolder expand">
                    <#if processModel??><#list processModel as pmc>
                    <li><a name="${pmc.name!''}" category="${pmc.category!''}" onclick="BaseModelTree.viewModelCategory('${pmc.category!''}');">${pmc.name!''}</a> <#if pmc.processModel??>
                        <ul>
                            <#list pmc.processModel as pm>
                            <li><a id="${pm.id!''}" name="${pm.name!''}" href="${rc.getContextPath()}/manage/model/getModelDetail?id=${pm.id!''}" target="ajax" rel="modelDetail" key="${pm.key!''}">${pm.name!''}</a>
                            </li> </#list>
                        </ul> </#if></li> </#list> </#if>
                </ul>
            </div>
        </div>
        <div id="modelDetail" layoutH="10" class="unitBox treeBox" >
            <div class="treeTip"><@label key="treeTips.M">请点击左侧树形菜单进行相关操作</@label></div>
        </div>
        <!-- <form id="modelform" action="" method="post" class="required-validate" onsubmit="return validateCallback(this, BaseModelTree.modelSaveAjaxDone)">
            <input type="hidden" name="navTabId" value="${navTabId!''}">

            <div id="modelDetail" class="pageFormContent nowrap " style="margin-left: 280px; padding:0;display: block; overflow: hidden;">
                 <div  style="padding:10px;">
                <div class="treeTip"><@label key="treeTips.M">请点击左侧树形菜单进行相关操作</@label></div>
                </div>
            </div>
        </form> -->

    </div>
</div>


